import 'package:word_range_client/config/RepositoryConfig.dart';
import 'package:word_range_client/pojo/Result.dart';
import 'package:word_range_client/repositories/HttpService.dart';

import '../pojo/dto/PageDto.dart';

class EventRepository{
  static String get _serverUrl => RepositoryConfig().serverUrl;
  static final HttpService _httpService = HttpService(_serverUrl);

  static Future<PageDto> getAllEvent() async {
    try{
      PageDto result = await _httpService.getPageDto("apiV1/event/list", queryParameters: {"pageSize":100});
      return result;
    }catch(e){
      throw Exception("$e");
    }
  }

  static Future<Result> getConditionListByEvent(String eventId) async {
    try{
      Result result = await _httpService.get("apiV1/condition/getConditionListByEvent/$eventId");
      return result;
    }catch(e){
      throw Exception("$e");
    }
  }
}